package de.dhbwstuttgart.vincon.telefoncompany.utils;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

public class TextReader {

	private ArrayList<String> data;
	
	public TextReader(String path) {
		data = new ArrayList<String>();
		try {
			BufferedReader in = new BufferedReader(new FileReader(path));
			String zeile = null;
			while ((zeile = in.readLine()) != null) {
				data.add(zeile);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public String getRandomData(){
		int index = (int)(Math.random() * data.size()-1);
		return data.get(index);
	}
}
